home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 11 / Info-Mac_XI_Disc_1.cdr_ / Info-Mac XI Disc 1.cdr / Programs / Disk & File / HC Encrypt 1.6.5 / HCE 2 Encryption Algorithm < prev    next >
Encoding:
Text File  |  1996-12-17  |  3.6 KB  |  40 lines  |  [ttro/ttxt]

  1. Description of the HCE 2 encryption algorithm
  2. © 1996-97 Yellow Lemon Software, all rights reserved.
  3. Last updated on 16th December 1996.
  4.  
  5. The algorithm requires one key and data to be encrypted.
  6.  
  7. The key is first converted to a one-way checksum with seed HCE2. The checksum algorithm is described in the document "HCE File Format", which is included with the freely available HC Encrypt (current version as of this writing is 1.6). Note that this checksum is scrambled by adding the first letter of the checksum to the second, then dividing the result of this operation by the first letter of the checksum. A random number between 0 and 9 is the put after char x of the checksum, where x is the result of the division. The checksum is unscrambled using the same procedure, except that letter x+1 of the checksum is deleted.
  8.  
  9. Then, the key is converted to a format which can be used by the algorithm. This format is simply the key’s different letters in ASCII code, each separated with a blank space. (The key "TestKey" will, without the quotes, become "84 101 115 116 75 101 121".)
  10.  
  11. Encrypting
  12.  
  13. Initially, a counter is set to 1. This counter will increment with one each time a new letter is encrypted, until it reaches the number of words in the ASCII code version of the key, where it will be reset to one (after it has encrypted using the final word of the ASCII code version of the key once). We will call this counter CNT. Each time the procedure loops, the current letter in the file is converted to ASCII code and put into a variable we will call LTR. Then word CNT of the key (that is, the ASCII coded version) is put into a variable we will call K.
  14.  
  15. The counter CNT is then divided with two to check whether or not it is an even number. If it is, LTR will be added to K and put into a variable we call ENC. If ENC’s value is above 255 (highest possible ASCII code), we subtract 255 from ENC. If CNT is not an even number, K is subtracted from LTR and put into ENC. If ENC’s value is below 1, 255 is added to ENC.
  16.  
  17. ENC is then converted back to letter form (i.e. not ASCII code) and put after a variable we call ENCDATA. CNT is then incremented with one (or reset to one, if it has reached the number of words in the ASCII code version of the key). The procedure then loops.
  18.  
  19. Decrypting
  20.  
  21. We use the same variables as above, except that we call ENC and ENCDATA DEC and DECDATA, respectively. LTR is converted to ASCII code. We then check if CNT is an even number. If so, we put subtract 255 from LTR and put it into DEC. If we add K to DEC and the result is within 1 and 255, then we convert DEC to letter form and put it after DECDATA.
  22.  
  23. If CNT is not an even number, then we subtract K from LTR and put the result into DEC. If DEC is below 1, then we add 255 to DEC, before we convert DEC to letter form and put it after DECDATA.
  24.  
  25. CNT is incremented by one (using the same rules as above), before the procedure loops.
  26.  
  27. More information...
  28.  
  29. You can understand the algorithm better by taking a look at the scripts used to perform encryption and decryption in the HC Encrypt stack. (Note that the encryption script is not available to unregistered users of HC Encrypt.)
  30.  
  31. Legal stuff
  32. HC Encrypt and the HCE 2 algorithm, as well as this file is © 1996-97 Yellow Lemon Software, all rights reserved.
  33.  
  34. The HCE 2 algorithm is available for licensing. The fees are $15 for a freeware program, $50 for a shareware license and $200 for a commercial license. Full crediting is expected. To receive more information, send e-mail to stoedle@online.no or snail-mail to
  35. Daniel Stødle
  36. Yellow Lemon Software
  37. Fogd Dreyersgt. 21
  38. N-9008 Tromsø
  39. NORWAY
  40. Any comments on the algorithm is also very much appreciated.